import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:mokeng/utils/utils.dart';

class StoreController extends GetxController with GetSingleTickerProviderStateMixin {
  /// 成员变量
  // tab 页标题
  final tabList = [].obs;
  late final TabController tabController;

  // 拉取数据
  Future<void> fetchFloor() async {
    Loading.show();
    var result = await HttpUtil().get('/floor/getFloorArr', data: {
      "adminPermission": "mokeng666",
    });
    Loading.dismiss();
    if (result['statusCode'] != "200") {
      toast(result['message']);
      return;
    }
    tabList.clear();
    tabList.addAll(result['result']);
    tabController = TabController(initialIndex: 0, length: tabList.length, vsync: this);
  }

  /// 可 async 拉取数据
  /// 可触发展示交互组件
  /// onInit 之后
  @override
  void onReady() {
    super.onReady();
    fetchFloor();
  }
}
